package com.jiangruan.javaproject;

import com.jiangruan.javaproject.address.Address;
import com.jiangruan.javaproject.bean.*;
import com.jiangruan.javaproject.rpc.*;
import com.jiangruan.javaproject.service.HotVideoService;

import java.security.KeyPair;
import java.util.List;
import java.util.Scanner;

//程序的入口类
public class Main {
    public static void main(String[] args) {

        while (true) {
            System.out.println("欢迎使用funk牌厨房");
            System.out.println("退出请按0");
            System.out.println("热门视频查询请按1");
            System.out.println("天气预报查询请按2");
            System.out.println("比特币getbestblockhash功能请按3");
            System.out.println("比特币getblockcount功能请按4");
            System.out.println("生成比特币地址功能请按5");
            System.out.println("比特币getblockchaininfo功能请按6");
            System.out.println("星座查询请按7");
            System.out.println("星座配对请按8");
            System.out.println("比特币getchaintips功能请按9");
            System.out.println("比特币getmemoryinfo功能请按10");

            Scanner kp = new Scanner(System.in);
            int rt = kp.nextInt();
            switch (rt) {
                case 0:
                    System.out.println("谢谢光临funk牌厨房，欢迎下次光临");
                    return;

                case 1:
                    List<HotVideo> hotVideo = HotVideoService.getHotVideo();
                    System.out.println("查询到热门视频信息：" + hotVideo.size() + "条");
                    int a = 0;
                    for (Object i : hotVideo) {
                        System.out.println("第" + (a + 1) + "条热门视频：");
                        System.out.println("作者：" + hotVideo.get(a).getAuthor());
                        System.out.println("标题：" + hotVideo.get(a).getTitle());
                        System.out.println("视频链接：" + hotVideo.get(a).getShare_url());
                        System.out.println("图片链接：" + hotVideo.get(a).getItem_cover());
                        System.out.println("热度指数：" + hotVideo.get(a).getHot_value());
                        System.out.println("热点词汇：" + hotVideo.get(a).getHot_words());
                        System.out.println("播放数：" + hotVideo.get(a).getPlay_count());
                        System.out.println("点赞数：" + hotVideo.get(a).getDigg_count());
                        System.out.println("评论数：" + hotVideo.get(a).getComment_count());
                        a++;
                        System.out.println();
                    }
                    break;

                case 2:
                    List<TianQVideo> tianq = HotVideoService.getTianq();
                    System.out.println("查询到今天天气情况：");
                    System.out.println("城市：" + tianq.get(0).getCity());
                    System.out.println("天气情况：" + tianq.get(0).getRealtime().get(0).getInfo());
                    System.out.println("温度：" + tianq.get(0).getRealtime().get(0).getTemperature());
                    System.out.println("湿度：" + tianq.get(0).getRealtime().get(0).getHumidity());
                    System.out.println("风向：" + tianq.get(0).getRealtime().get(0).getDirect());
                    System.out.println("风力：" + tianq.get(0).getRealtime().get(0).getPower());
                    System.out.println("空气质量：" + tianq.get(0).getRealtime().get(0).getAqi());
                    System.out.println();
                    int b = 0;
                    for (Object ia : tianq.get(0).getFuture()) {
                        System.out.println("第" + (b + 2) + "天天气情况");
                        System.out.println("日期：" + tianq.get(0).getFuture().get(b).getDate());
                        System.out.println("温度：" + tianq.get(0).getFuture().get(b).getTemperature());
                        System.out.println("天气情况：" + tianq.get(0).getFuture().get(b).getWeather());
                        System.out.println("风向：" + tianq.get(0).getFuture().get(b).getDirect());
                        b++;
                        System.out.println();
                    }
                    break;

                case 3:
                    String bestBlockHash = GetBestBlockHash.getBestBlockHash();
                    System.out.println("比特币1001区块的哈希值：" + bestBlockHash);
                    break;

                case 4:
                    int bestBlockCount = GetBlockCount.getBlockCount();
                    System.out.println("区块数:" + bestBlockCount);
                    break;

                case 5:
                    KeyPair keyPair = Address.generateKeys();
                    String reslut = Address.newAddress(keyPair);
                    System.out.println(reslut);
                    boolean b1 = Address.validateAddr(reslut);
                    if (b1) {
                        System.out.println("该比特币地址符合规范");
                    } else {
                        System.out.println("该比特币地址不符合规范");
                    }
                    break;

                case 6:
                    List<GetBlockChaininfoEntityR> blockChaininfo = GetBlockChaininfo.getBlockChaininfo();
                    System.out.println("连锁:" + blockChaininfo.get(0).getChain());
                    System.out.println("总区块数:" + blockChaininfo.get(0).getBlocks());
                    System.out.println("头部文件数:" + blockChaininfo.get(0).getHeaders());
                    System.out.println("哈希值:" + blockChaininfo.get(0).getBestblockhash());
                    System.out.println("困难度:" + blockChaininfo.get(0).getDifficnlty());
                    System.out.println("中数时间:" + blockChaininfo.get(0).getMediantime());
                    System.out.println("验证过程:" + blockChaininfo.get(0).getVerificationprogress());
                    System.out.println("初始块下载:" + blockChaininfo.get(0).isInitialblockdownload());
                    System.out.println("编织品:" + blockChaininfo.get(0).getChainwork());
                    System.out.println("磁盘上的大小:" + blockChaininfo.get(0).getSize_on_disk());
                    System.out.println("被修剪:" + blockChaininfo.get(0).pruned);
                    System.out.println("修剪高度:" + blockChaininfo.get(0).getPruneheight());
                    System.out.println("自动修剪:" + blockChaininfo.get(0).automatic_pruning);
                    System.out.println("删除目标大小:" + blockChaininfo.get(0).getPrune_target_size());
                    break;

                case 7:
                    List<XingZuoPueksR> xing = HotVideoService.getXing();
                    System.out.println("星座：" + xing.get(0).getName());
                    System.out.println("星座时间：" + xing.get(0).getRange());
                    System.out.print("性格特征：" + xing.get(0).getZxtd());
                    System.out.print("  " + xing.get(0).getBx());
                    System.out.print("  " + xing.get(0).getYd());
                    System.out.println("  " + xing.get(0).getQd());
                    System.out.print("属性：" + xing.get(0).getSssx());
                    System.out.print("  " + xing.get(0).getZggw());
                    System.out.print("  " + xing.get(0).getYysx());
                    System.out.print("  " + xing.get(0).getZdtz());
                    System.out.print("  " + xing.get(0).getZgxx());
                    System.out.print("  " + xing.get(0).getXyys());
                    System.out.println("  " + xing.get(0).getJssw());
                    System.out.print("幸运：" + xing.get(0).getXyhm());
                    System.out.println("  " + xing.get(0).getKyjs());
                    System.out.print(xing.get(0).getName() + "简语：" + xing.get(0).getJbtz());
                    System.out.println(xing.get(0).getJttz());
                    System.out.println("  " + xing.get(0).getXsfg());
                    System.out.println("  " + xing.get(0).getGxmd());
                    System.out.println("  " + xing.get(0).getZj());
                    break;

                case 8:
                    List<XingZuoPksR> xingP = HotVideoService.getXingP();
                    System.out.println("查询的星座：" + xingP.get(0).getMen() + "  " + xingP.get(0).getWomen());
                    System.out.println("指数：" + xingP.get(0).getZhishu());
                    System.out.println("比重：" + xingP.get(0).getBizhong());
                    System.out.println("相悦：" + xingP.get(0).getXiangyue());
                    System.out.println("天长地久：" + xingP.get(0).getTcdj());
                    System.out.println("结果：" + xingP.get(0).getJieguo());
                    System.out.println("恋爱：" + xingP.get(0).getLianai());
                    System.out.println("注意：" + xingP.get(0).getZhuyi());
                    break;

                case 9:
                    GetChaintips getChaintips = new GetChaintips();
                    List<GetChaintipsUQRes> chaintips = getChaintips.getChaintips();
                    int u = 0;
                    for (Object i : chaintips) {
                        System.out.println("链头区块的高度：" + chaintips.get(u).getHeight());
                        System.out.println("链头区块的哈希：" + chaintips.get(u).getHash());
                        System.out.println("距离主链分叉点的长度，主链为0：" + chaintips.get(u).getBranchlen());
                        System.out.println("链状态：" + chaintips.get(u).getStatus());
                        u++;
                        System.out.println();
                    }
                    break;

                case 10:
                    GetMemoryInfo getMemoryInfo = new GetMemoryInfo();
                    List<GetMemoryInfoEnLb> memoryInfojn = getMemoryInfo.getMemoryInfojn();
                    System.out.println("加锁内存信息对象信息：");
                    System.out.println("已使用字节数：" + memoryInfojn.get(0).getLocked().get(0).getUsed());
                    System.out.println("空闲字节数：" + memoryInfojn.get(0).getLocked().get(0).getFree());
                    System.out.println("全部字节数：" + memoryInfojn.get(0).getLocked().get(0).getTotal());
                    System.out.println("成功锁定字节数：" + memoryInfojn.get(0).getLocked().get(0).getLocked());
                    System.out.println("已分配内存块：" + memoryInfojn.get(0).getLocked().get(0).getChunks_used());
                    System.out.println("空闲内存块：" + memoryInfojn.get(0).getLocked().get(0).getChunks_free());
                    System.out.println();
                    break;

                default:
                    System.out.println("不好意思，厨房没有这种食材");
                    System.out.println();
                    break;

            }

        }






    }
}
